package com.kotlin.book.adapter

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.kotlin.book.fragments.ShelfFragmentIndex

class ShelfFragmentAdapter(
    fragment: Fragment
) : FragmentStateAdapter(fragment) {

    override fun getItemCount(): Int {
        return 2
    }

    override fun createFragment(position: Int): Fragment {
        // 创建并返回对应位置的 Fragment
        if (position == 0) {
            return ShelfFragmentIndex()
        } else {
            return ShelfFragmentIndex()
        }
    }
}